package myspring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * <pre>
 *   Title: SpringDemo001.java
 *   Description: 
 *   Copyright: yundaex.com Copyright (c) 2013
 *   Company: 上海韵达货运有限公司
 * </pre>
 * 
 * @author liuzhaoqing
 * @version 1.0
 * @date 2014年10月24日
 */
public class SpringDemo001 {

	public static void main(String[] args) {
		ApplicationContext cxt = null;
		cxt = new ClassPathXmlApplicationContext("spring-context.xml");
		cxt = new FileSystemXmlApplicationContext("classpath:spring-context.xml");
		cxt = new FileSystemXmlApplicationContext("target/classes/spring-context.xml");
		Person p = null;
		if (cxt.containsBean("person")) {
			p = cxt.getBean("person", Person.class);
			System.out.println(p.toString());
		}
		p = cxt.getBean("person0", Person.class);
		if (p.getAge() > -1) {
			System.out.println("初始化。。。");
		}
		System.out.println(p.toString());
	}
}
